package utils;

import com.alibaba.fastjson.JSONObject;

public class Inspector {
    public static boolean hasEmpty(Object ... objects){
        for (Object o : objects) {
            if (o == null)
                return true;
        }
        return false;
    }
    public static boolean isEmpty(Object object){
        return object == null;
    }
    public static boolean notEmpty(Object object){
        return object != null;
    }

    public static boolean jsonHashEmpty(JSONObject json, String... keys){
        for (String key : keys)
            if (!json.containsKey(key)) return true;
        return false;
    }

    public static boolean isSuccess(JSONObject result) {
        return result != null && "OK".equalsIgnoreCase(result.getString("errorDesc")) && "0".equalsIgnoreCase(result.getString("errorCode"));
    }
}
